package kr.hkit.powerjava.chapter6;

import java.util.Scanner;

public class Gcd {
	public static void main(String[] args) {
		int x;
		int y;
		
		System.out.println("두개의 정수를 입력하시오. (큰수, 작은수)");
		Scanner input = new Scanner(System.in);
		
		x=input.nextInt();
		y=input.nextInt();
		
		calGcd(x,y);
		
	}

	private static void calGcd(int x, int y) {
		int r;
		while(y !=0){
			r = x % y;
			x = y;
			y = r;
			
		}
		System.out.println("최대공약수는" + x + "입니다.");
	}

}
